home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Cookie / personal-counter.izs < prev    next >
Text File  |  2005-09-28  |  2KB  |  103 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Personal Counter
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>This personal counter tallies and displays the # of visits by the current visitor to your page. Uses cookies to accomplish the task. 
  7.  
  8. <!/DESCRIPTION> 
  9.  
  10. <!CATEGORY>cookies<!/CATEGORY>
  11.  
  12. <!SCRIPT>
  13. <!-- START OF SCRIPT -->
  14. <style>
  15. .counter{
  16. background-color:black;
  17. color:yellow;
  18. font-weight:bold;
  19. }
  20. </style>
  21.  
  22. <SCRIPT>
  23. expireDate = new Date
  24. expireDate.setMonth(expireDate.getMonth()+6)
  25. jcount = eval(cookieVal("jaafarCounter"))
  26. jcount++
  27. document.cookie = "jaafarCounter="+jcount+";expires=" + expireDate.toGMTString()
  28.  
  29. function cookieVal(cookieName) {
  30. thisCookie = document.cookie.split("; ")
  31. for (i=0; i<thisCookie.length; i++){
  32.     if (cookieName == thisCookie[i].split("=")[0]){
  33.         return thisCookie[i].split("=")[1]
  34.     }
  35. }
  36. return 0
  37. }
  38.  
  39. function page_counter(){
  40. for (i=0;i<(7-jcount.toString().length);i++)
  41. document.write('<span class="counter">0</span>')
  42. for (y=0;y<(jcount.toString().length);y++)
  43. document.write('<span class="counter">'+jcount.toString().charAt(y)+'</span>')
  44. }
  45.  
  46. </SCRIPT>
  47.  
  48. You have visited this page 
  49. <SCRIPT>
  50. page_counter(jcount);
  51. </SCRIPT>
  52.  times.
  53. <!-- END OF SCRIPT -->
  54. <!/SCRIPT>
  55.  
  56. <!PREVIEW>
  57. <!-- START OF SCRIPT -->
  58. <style>
  59. .counter{
  60. background-color:black;
  61. color:yellow;
  62. font-weight:bold;
  63. }
  64. </style>
  65.  
  66. <SCRIPT>
  67. expireDate = new Date
  68. expireDate.setMonth(expireDate.getMonth()+6)
  69. jcount = eval(cookieVal("jaafarCounter"))
  70. jcount++
  71. document.cookie = "jaafarCounter="+jcount+";expires=" + expireDate.toGMTString()
  72.  
  73. function cookieVal(cookieName) {
  74. thisCookie = document.cookie.split("; ")
  75. for (i=0; i<thisCookie.length; i++){
  76.     if (cookieName == thisCookie[i].split("=")[0]){
  77.         return thisCookie[i].split("=")[1]
  78.     }
  79. }
  80. return 0
  81. }
  82.  
  83. function page_counter(){
  84. for (i=0;i<(7-jcount.toString().length);i++)
  85. document.write('<span class="counter">0</span>')
  86. for (y=0;y<(jcount.toString().length);y++)
  87. document.write('<span class="counter">'+jcount.toString().charAt(y)+'</span>')
  88. }
  89.  
  90. </SCRIPT>
  91.  
  92. You have visited this page 
  93. <SCRIPT>
  94. page_counter(jcount);
  95. </SCRIPT>
  96.  times.
  97.  
  98.  
  99. <!-- END OF SCRIPT -->
  100. <!/PREVIEW>
  101.  
  102. <!RELATED>NONE<!/RELATED>
  103.